// 主题颜色 -- 用于单据通用页面

var cssIndex = [],//获取样式表-注意排序
    cssIndex2 = [],
    // 获取 motif 样式表
    isMotif = JSON.parse(window.localStorage.getItem('layuiAdmin')) ? JSON.parse(window.localStorage.getItem('layuiAdmin')).theme.color.main : "";//默认主题

//设置不同透明度的颜色 /10% - 100%/ 注意透明度的大小写

var pellucidityOne = JSON.parse(window.localStorage.getItem('layuiAdmin')).theme.color.header + "1a",
    pellucidityTwo = JSON.parse(window.localStorage.getItem('layuiAdmin')).theme.color.header + "33",
    pellucidityThree = JSON.parse(window.localStorage.getItem('layuiAdmin')).theme.color.header + "4d",
    pellucidityFour = JSON.parse(window.localStorage.getItem('layuiAdmin')).theme.color.header + "66",
    pellucidityFive = JSON.parse(window.localStorage.getItem('layuiAdmin')).theme.color.header + "80",
    pelluciditySix = JSON.parse(window.localStorage.getItem('layuiAdmin')).theme.color.header + "99",
    pelluciditySeven = JSON.parse(window.localStorage.getItem('layuiAdmin')).theme.color.header + "b3",
    pellucidityEight = JSON.parse(window.localStorage.getItem('layuiAdmin')).theme.color.header + "cc",
    pellucidityNine = JSON.parse(window.localStorage.getItem('layuiAdmin')).theme.color.header + "e6",
    pellucidityTen = JSON.parse(window.localStorage.getItem('layuiAdmin')).theme.color.header + "ff";
window.onload = alterMotifList()


// console.log(window)

function alterMotifList() {
    for (var i = 0; i < document.styleSheets.length; i++) {
        var sheet = document.styleSheets[i];
        if (sheet.href != null && sheet.href.indexOf("motif-list") >= 0) {
            // if (sheet.title === "motif-list") {
            cssIndex = sheet.cssRules;
        }
    }

    if (JSON.parse(window.localStorage.getItem('layuiAdmin'))) {
        if (cssIndex[0]) {
            // 修改cssIndex样式表的预设元素 /dh-motif.css
            cssIndex[0].style.setProperty(cssIndex[0].style[0], pellucidityOne)
            cssIndex[0].style.setProperty(cssIndex[0].style[1], pellucidityTwo)
            cssIndex[0].style.setProperty(cssIndex[0].style[2], pellucidityThree)
            cssIndex[0].style.setProperty(cssIndex[0].style[3], pellucidityFour)
            cssIndex[0].style.setProperty(cssIndex[0].style[4], pellucidityFive)
            cssIndex[0].style.setProperty(cssIndex[0].style[5], pelluciditySix)
            cssIndex[0].style.setProperty(cssIndex[0].style[6], pelluciditySeven)
            cssIndex[0].style.setProperty(cssIndex[0].style[7], pellucidityEight)
            cssIndex[0].style.setProperty(cssIndex[0].style[8], pellucidityNine)
            cssIndex[0].style.setProperty(cssIndex[0].style[9], pellucidityTen)
        }
    }

}
